﻿<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    <environment include="Development">
        <link href="~/lib/twitter-bootstrap/css/bootstrap.css" rel="stylesheet" asp-append-version="true" />
        <script src="~/lib/jquery/jquery.js" asp-append-version="true"></script>
        <script src="~/lib/twitter-bootstrap/js/bootstrap.js" asp-append-version="true"></script>
        <script src="~/lib/jquery-validate-v1.11.0/jquery.validate.js" asp-append-version="true"></script>
        <script src="~/lib/jquery-validate-unobtrusive-hooks/src/jquery.validate.hooks.js" asp-append-version="true"></script>

    </environment>
    <environment exclude="Development">
        <link href="~/lib/twitter-bootstrap/css/bootstrap.min.css" rel="stylesheet" asp-append-version="true" />
        <script src="~/lib/jquery/jquery.min.js" asp-append-version="true"></script>
        <script src="~/lib/twitter-bootstrap/js/bootstrap.min.js" asp-append-version="true"></script>
        <script src="~/lib/jquery-validate-v1.11.0/jquery.validate.min.js" asp-append-version="true"></script>
        <script src="~/lib/jquery-validate-unobtrusive-hooks/src/jquery.validate.hooks.min.js" asp-append-version="true"></script>
    </environment>
    <link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />


</head>
<body>
    @using Microsoft.AspNetCore.Identity
    @inject SignInManager<IdentityUser> _signInMananger
    <div class="container">
        <nav class="navbar navbar-expand-sm bg-dark navbar-dark">
            <a class="navbar-brand" asp-controller="home" asp-action="index">
                <img src="~/images/student.png" width="30" height="30" />
            </a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
                <span class="navbar-toggler-icon"> </span>
            </button>
            <div class="collapse navbar-collapse" id="collapsibleNavbar">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" asp-controller="home" asp-action="index">学生列表</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" asp-controller="home" asp-action="create">添加学生</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" asp-controller="account" asp-action="Register">注册</a>
                    </li>
                </ul>
                <ul class="navbar-nav ml-auto">
                    @*如果已经登录，则显示注销*@
                    @if (_signInMananger.IsSignedIn(User))
                    {
                        <li class="nav-item">
                            <form method="post" asp-controller="account" asp-action="logout">
                                <button type="submit" style="width:auto" class="nav-link btn btn-link py-0">
                                    注销 @User.Identity.Name
                                </button>
                            </form>
                        </li>
                    }
                    else
                    {
                        <li class="nav-item">
                            <a class="nav-link" asp-controller="account" asp-action="register">
                                注册
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" asp-controller="account" asp-action="login">
                                登录
                            </a>
                        </li>
                    }

                </ul>
            </div>
        </nav>
        @RenderBody()
    </div>
    @if (IsSectionDefined("Scripts"))
    {
        @RenderSection("Scripts",required:false)
    }

</body>
</html>
